Passed
Pull Request — master (#141)
by
unknown
01:35
created

SideNav.render   A

Complexity

Conditions 1

Size

Total Lines 16
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 16
c 0
b 0
f 0
rs 9.7
cc 1
1
import React from 'react';
2
import PropTypes from 'prop-types';
3
import styled from 'styled-components';
4
5
import BasicButton from 'components/elements/basic-button';
6
7
export class SideNav extends React.PureComponent {
8
  static propTypes = {
9
    className: PropTypes.string,
10
    func: PropTypes.func,
11
    list: PropTypes.arrayOf(
12
      PropTypes.shape({
13
        id: PropTypes.string,
14
        value: PropTypes.string,
15
      }),
16
    ),
17
  };
18
19
  static defaultProps = {};
20
21
  render() {
22
    const { className, list } = this.props;
23
    const { func } = this.props;
24
    return (
25
      <ul className={className}>
26
        {list.map(item => (
27
          <li key={item.id}>
28
            <BasicButton
29
              className="navButton"
30
              func={() => func(item.id)}
31
              text={item.value}
32
            />
33
          </li>
34
        ))}
35
      </ul>
36
    );
37
  }
38
}
39
40
export default styled(SideNav)`
41
  list-style-type: none;
42
  padding: 0;
43
  width: 160px;
44
45
  .navButton {
46
    background: none;
47
    color: grey;
48
    text-align: left;
49
50
    &:hover {
51
      text-decoration: underline;
52
      color: black;
53
    }
54
  }
55
`;
56